package SwingModel;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
public class CmsQuiz {
	
	private int quizID;
	private String courseID;
	private String quizTitle;
	private String quizDescription;
	private double maxPoint;
	private double percentWeight;
	private Date createdDate;
	private Date avaiDate;
	private Date dueDate;
	private Date expDate;
	private int duration;
	private List<CmsQuizQuestion> questions;
	private boolean hasTaken;


	
	public CmsQuiz(int quizID, String quizTitle, String quizDescription, double maxPoint,
			double percentWeight, Date createdDate, Date avaiDate,
			Date dueDate, Date expDate, int duration,
			List<CmsQuizQuestion> questions, boolean hasTaken) {
		this.quizTitle = quizTitle;
		this.quizDescription = quizDescription;
		this.maxPoint = maxPoint;
		this.percentWeight = percentWeight;
		this.createdDate = createdDate;
		this.avaiDate = avaiDate;
		this.dueDate = dueDate;
		this.expDate = expDate;
		this.duration = duration;
		this.questions = questions;
		this.hasTaken = hasTaken;
		this.quizID = quizID;
	}
	
	
	@Override
	public String toString(){
		SimpleDateFormat sdf = new SimpleDateFormat("YYYY:MM:dd hh:mmaa");
		StringBuilder returnString = new StringBuilder();
		
		returnString.append("Quiz: \n"
				+ "  quizID: " + quizID + "\n"
				+ "  courseID: " + courseID + "\n"
				+ "  quizTitle: " + quizTitle + "\n"
				+ "  quizDescription: " + quizDescription + "\n"
				+ "  weight: " + percentWeight + "\n"
				+ "  duration: " + duration + "\n"
				+ "  hasTaken: " + hasTaken + "\n"
				+ "  createdDate: " + sdf.format(createdDate) + "\n"
				+ "  avaiDate: " + sdf.format(avaiDate) + "\n"
				+ "  dueDate: " + sdf.format(dueDate) + "\n"				
				+ "  expDate: " + sdf.format(expDate) + "\n");
		for(CmsQuizQuestion q : questions){
			returnString.append(q.toString());
		}
		return returnString.toString();
	}
	
	
	
	//---------------------------------------------------------
	//GETTERS AND SETTERS:
	//---------------------------------------------------------
	
	public int getQuizID() {
		return quizID;
	}
	public void setQuizID(int quizID) {
		this.quizID = quizID;
	}
	public String getQuizTitle() {
		return quizTitle;
	}
	public void setQuizTitle(String quizTitle) {
		this.quizTitle = quizTitle;
	}
	public String getQuizDescription() {
		return quizDescription;
	}
	public void setQuizDescription(String quizDescription) {
		this.quizDescription = quizDescription;
	}
	public double getMaxPoint() {
		return maxPoint;
	}
	public void setMaxPoint(double maxPoint) {
		this.maxPoint = maxPoint;
	}
	public double getPercentWeight() {
		return percentWeight;
	}
	public void setPercentWeight(double percentWeight) {
		this.percentWeight = percentWeight;
	}
	public Date getCreatedDate() {
		return createdDate;
	}
	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
	public Date getAvaiDate() {
		return avaiDate;
	}
	public void setAvaiDate(Date avaiDate) {
		this.avaiDate = avaiDate;
	}
	public Date getDueDate() {
		return dueDate;
	}
	public void setDueDate(Date dueDate) {
		this.dueDate = dueDate;
	}
	public Date getExpDate() {
		return expDate;
	}
	public void setExpDate(Date expDate) {
		this.expDate = expDate;
	}
	public int getDuration() {
		return duration;
	}
	public void setDuration(int duration) {
		this.duration = duration;
	}
	public List<CmsQuizQuestion> getQuestions() {
		return questions;
	}
	public void setQuestions(List<CmsQuizQuestion> questions) {
		this.questions = questions;
	}
	public boolean isHasTaken() {
		return hasTaken;
	}
	public void setHasTaken(boolean hasTaken) {
		this.hasTaken = hasTaken;
	}
	
}